var i=1;
function loadFlightNo(carrierName){
	
	var depCity=$("#depCity").val();
	var arrCity=$("#arrCity").val();
	var carrier = null;
	if(carrierName){
		carrier=$("#"+carrierName).val();
	}else{
		carrier=$("#airLineCompany").val();
	}
	if(depCity!=""&&arrCity!=""&&carrier!=""&&depCity!=arrCity&&depCity!="请选择"&&arrCity!="请选择"){
		var bool= isreflush(i,depCity,arrCity,carrier);
		if(bool){
	    		$.ajax({
	                  url : 'commonAction!outCityFlightNo.action',
	                  data : {'fromCity':depCity,'toCity':arrCity,'carrier':carrier},
	                  type : "POST",
	                  dateType:'json',
	                  beforeSend : function(XMLHttpRequest) {// 提交之前的处理代码放在此处,可空着
	                                    
	                  },
	                  success : function(data) {
	                	  $("#flightTime").html('');
	                	  document.getElementById("flightNo").innerHTML="";
	                	if(data==""||data==null){ 
	                		  //document.getElementById("flightNo").innerHTML="<option value=''>--选 择--</option>";
	                		  
	                		  var opt=document.createElement("OPTION");
	                		  opt.text = '--请选择--';
	                		  opt.value = '';
	                		  document.getElementById("flightNo").options.add(opt);
	                	 	  return ;
	                	  }
	                	/*  document.getElementById("flightNo").innerHTML="<option value=''ertyeryet>tyertyer--选 择--</option>"; */
	                	 var opt=document.createElement("OPTION");
	                		  opt.text = '--请选择--';
	                		  opt.value = '';
	                		  document.getElementById("flightNo").options.add(opt);
	                	  var unitys_str=data.split("#");
	                	 // alert($('#flightNo').html());
	                	  for(var i=0;i<unitys_str.length;i++){
	                		  var s_unity=unitys_str[i];
	                		  if(s_unity!="" || s_unity!=null){
	                			  var stext=s_unity.split("=");
	                				 if('channelId'==stext[0]||stext[0]==''){
		                				  continue;
		                			  }
	                			  var opt=document.createElement("OPTION");
	                			  document.getElementById("flightNo").options.add(opt);
	                			    opt.text=stext[1];
	                			    opt.value=stext[1];
	                			    opt.grade=stext[0];
	                			    
	                		   }
	                	  }
	                	 /// document.getElementById("flightNo").options[0].selected=true;
	                  },
	                  error : function(data) {
	                        alert('提示', '数据超时或错误,请重新提交');
	                  }
	            });
		}
	}
	i++;
}


/*
 * 比较上一次选择的值
 **/
 var v1,v2,v3;
 var isreflush=function compareSelectValue(i,o1,o2,o3){
			   if(v1!=o1||v2!=o2||v3!=o3){
			    			 v1=o1;
	 				    	 v2=o2;
	 				    	 v3=o3;
			    			return true;
			    		}
			    			 v1=o1;
 				    	 v2=o2;
 				    	 v3=o3;
			    	return false;
			    }